//
//  MyPopover.h
//  sandbox
//
//  Created by 杨岑 on 1/7/15.
//  Copyright (c) 2015 杨岑. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import "MyPopoverProperties.h"

typedef NS_ENUM(NSInteger, MyPopoverAnimation)
{
    MyPopoverAnimationPop,
    MyPopoverAnimationFade
};

@interface MyPopover : NSObject<NSAnimationDelegate>
@property (assign) BOOL animates;
@property (assign) MyPopoverAnimation animation;
@property (assign) NSTimeInterval animationDuration;
@property (nonatomic, readonly) MyPopoverProperties* properties;
@property (nonatomic) NSViewController* contentViewController;

+ (instancetype)createWith:(NSViewController*)vc;
- (instancetype)initWith:(NSViewController*)vc;

// Position: first letter of top/bottom/left/right.
// Point/rectangle should be in screen coordinate system.
- (void)popAt:(NSPoint)hotspot preferredPosition:(char)position;
- (void)popAround:(NSRect)hotspotRect preferredPosition:(char)position;

@end
